#include <iostream>
using namespace std;

//单词分析
int main()
{
  int hash[26] = { 0 };

  char ch = 0;
  while (cin >> ch)
  {
    ++hash[ch-'a'];
  }

  int maxch = 0;
  int max_index = 0;

  for (int i = 0; i<26; ++i)
  {
    if (hash[i] > maxch)
    {
        maxch = hash[i];
        max_index = i;
    }

  }

  printf("%c\n%d", max_index+'a', hash[max_index]);
  return 0;
}